import request from '@/utils/request'
//获取用户列表
export const reqUserList = (page,limit,username='')=>request.get(`/admin/acl/user/${page}/${limit}?username=${username}`)
// 存储和更新用户
export const reqAddOrUpdateUser = (data) => { 
    if (data.id) {
        return request.put('/admin/acl/user/update',data)
    } else { 
        return request.post('/admin/acl/user/save',data)
    }
}

// 删除用户
export const reqDeleteUser = id=>request.delete(`/admin/acl/user/remove/${id}`)

//根据用户id获取用户有哪些角色
export const reqUserRoleList = (userId)=>request.get(`/admin/acl/user/toAssign/${userId}`)

//给用户分配角色
export const reqGiveUserRoles = (userId,roleId)=>request.post(`/admin/acl/user/doAssign?userId=${userId}&roleId=${roleId}`)

